package com.aspose.cells;

class zbgn extends zck {
   private float k = 0.0F;

   zbgn(zn var1, float var2, float var3, zbkr var4) {
      super(var1, var2, var3, var4);
   }

   com.aspose.cells.b.a.b.a.ze a(com.aspose.cells.b.a.b.zq var1) {
      com.aspose.cells.b.a.b.a.ze var2 = new com.aspose.cells.b.a.b.a.ze();
      if (this.e.m != null) {
         if (this.e.m.a.size() > 0) {
            this.k = Math.min(var1.h(), var1.i()) * com.aspose.cells.b.a.ze.a(this.e.m.a.get(0)) / 100000.0F;
         } else {
            this.k = Math.min(var1.h(), var1.i()) * 0.24F;
         }
      } else {
         this.k = Math.min(var1.h(), var1.i()) * 0.24F;
      }

      if (this.k <= 0.0F) {
         var2.b(var1);
         var2.i();
         return var2;
      } else {
         com.aspose.cells.b.a.b.zo[] var3 = new com.aspose.cells.b.a.b.zo[]{new com.aspose.cells.b.a.b.zo(this.k + this.g, this.h), new com.aspose.cells.b.a.b.zo(var1.h() - this.k + this.g, this.h), new com.aspose.cells.b.a.b.zo(var1.h() + this.g, var1.i() / 2.0F + this.h), new com.aspose.cells.b.a.b.zo(var1.h() - this.k + this.g, var1.i() + this.h), new com.aspose.cells.b.a.b.zo(this.k + this.g, var1.i() + this.h), new com.aspose.cells.b.a.b.zo(this.g, var1.i() / 2.0F + this.h)};
         var2.a(var3[0], var3[1]);
         var2.a(var3[1], var3[2]);
         var2.a(var3[2], var3[3]);
         var2.a(var3[3], var3[4]);
         var2.a(var3[4], var3[5]);
         var2.a(var3[5], var3[0]);
         var2.i();
         return var2;
      }
   }

   void a() {
      com.aspose.cells.b.a.b.zq var1 = this.d(this.e.v());
      super.c(var1);
   }

   private com.aspose.cells.b.a.b.zq d(com.aspose.cells.b.a.b.zq var1) {
      if (this.e.m != null) {
         if (this.e.m.a.size() > 0) {
            this.k = Math.min(var1.h(), var1.i()) * com.aspose.cells.b.a.ze.a(this.e.m.a.get(0)) / 100000.0F;
         } else {
            this.k = Math.min(var1.h(), var1.i()) * 0.24F;
         }
      } else {
         this.k = Math.min(var1.h(), var1.i()) * 0.24F;
      }

      if (this.k <= 0.0F) {
         return var1;
      } else {
         float var2 = 0.0F;
         float var3 = 0.0F;
         float var4 = 0.0F;
         float var5 = this.k;
         float var6 = var1.i() / 2.0F;
         float var7 = var1.h() / var1.i();
         if (var7 > 1.0F) {
            var7 = var1.i() / var1.h();
         }

         float var8 = var5 * var7;
         float var9 = var5 - var5 * var7;
         float var10;
         if ((double)var7 > 0.5D) {
            var10 = var8;
            var8 = var9;
            var9 = var10;
         }

         for(var10 = var8; var10 <= var9; ++var10) {
            float var11 = var5 - var10;
            float var12 = var6 * var11 / var5;
            float var13 = (var1.h() - 2.0F * (var5 - var11)) * (var1.i() - 2.0F * var12);
            if (var13 > var2) {
               var2 = var13;
               var3 = var5 - var11;
               var4 = var12;
            }
         }

         com.aspose.cells.b.a.b.zq var14 = new com.aspose.cells.b.a.b.zq(var1.f() + var3, var1.g() + var4, var1.h() - 2.0F * var3, var1.i() - 2.0F * var4);
         return var14;
      }
   }
}
